package com.books.controller.back;

import com.books.model.bo.Result;
import com.books.model.entity.back.Back;
import com.books.service.back.IBackService;
import com.books.service.order.impl.OrderListServerImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author 饿熊的咆哮
 * @Date 2021/10/15 10:55
 * @Version 1.0
 */
@Controller
@RequestMapping("/back")
public class BackController {
    @Autowired
    private IBackService backService;
    @Autowired
    private OrderListServerImpl orderListServer;

    @GetMapping("/back")
    public String back(){
        return "back/back";
    }

    @PostMapping("/addBack")
    @ResponseBody
    public Result addBack(Back back){
        backService.addBack(back);
        orderListServer.upStId (4,back.getOrderListId ());
        return new Result("200","提交申请");
    }
}
